home *** CD-ROM | disk | FTP | other *** search
- Path: atglab.bls.com!Alun.Champion
- From: Alun.Champion@bridge.bst.bls.com (Alun Champion)
- Newsgroups: comp.lang.c
- Subject: Re: How do you pass along a variable argument list?
- Date: 11 Jan 1996 14:37:32 GMT
- Organization: Computer People Inc.
- Message-ID: <ALUN.CHAMPION.96Jan11093732@g7240065.bridge.bst.bls.com>
- References: <4d1i8v$k8h@news.mcl.bdm.com> <4d30nv$k8r@tahko.lpr.carel.fi>
- NNTP-Posting-Host: bstfirewall.bst.bls.com
- In-reply-to: aril@cmt.lpr.mail.carel.fi's message of Thu, 11 Jan 1996 12:38:07
- GMT
-
- In article <4d30nv$k8r@tahko.lpr.carel.fi> aril@cmt.lpr.mail.carel.fi (Ari Lukumies) writes:
-
- : ywu@plato.sky.bdm.com wrote:
-
- :> I am writing a wrapper around a routine which takes variable argument list only. I
- :> want my wrapper has the similar prototype and can pass the variable arguments
- :> directly to the routine(by the way, I cannot change the code of that routine).
-
- :> I guess it is really hard to do it in ANSI, and I know how to do it in a stupid
- :> way---but, is there any way around??
-
- : Actually, it's not so difficult. Here's an ANSI-compliant example that
- : wraps the printf function:
-
- : #include <stdio.h>
- : #include <stdarg.h>
-
- : void MyPrintf(char *fmt, ...)
- : {
- : va_list argp;
-
- : va_start(argp, fmt);
- : printf(fmt, argp);
-
- Almost ANSI-compliant ;') This is meant to be vprintf()
-
- : va_end(argp);
- : }
-
- Regards
-
- -A.
- --
- | A.Champion |
-